package com.bs.controller;

import com.bs.entity.Student;
import com.bs.service.IStudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/stu")
public class StudentController {
    @Autowired
    private IStudentService service;

    @RequestMapping("/list")
    public String  list(Model model, Student student){

        if(student==null && student.getSex()==null){
            student.setSex(-1);
        }

        List<Student> list = service.all(student);
        System.out.println(list);
        model.addAttribute("list");


        return "stu/list";
    }

}
